/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
/* vi: set expandtab shiftwidth=4 tabstop=4: */

#include <stdint.h>
#include "XorHashMacro.h"

/** \brief 32-bit hash by Robert Jenkins
 *
 * As described on http://www.concentric.net/~Ttwang/tech/inthash.htm
 *
 * License: Public Domain?
 */
class RobertJenkinsHash32
{
public:

    const char* name() const
    {
        return "RobertJenkins_alt";
    }

    uint32_t hash32(uint32_t a) const
    {
        a = (a + 0x7ed55d16) + (a<<12);
        a = (a ^ 0xc761c23c) ^ (a>>19);
        a = (a + 0x165667b1) + (a<<5);
        a = (a + 0xd3a2646c) ^ (a<<9);
        a = (a + 0xfd7046c5) + (a<<3);
        a = (a ^ 0xb55a4f09) ^ (a>>16);
        return a;
    }

    XORHASH

};
